Azure Static Webapp workflow testing - #71
Conversation
Github workflow for testing purpose
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a GitHub Actions workflow for manually deploying to Azure Static Web Apps, including environment mapping, build steps, and deployment via the Azure static-web-apps-deploy action, plus a staticwebapp.config.json enabling SPA navigation fallback to index.html. ChangesAzure Deployment Setup
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant SetEnvironmentJob
participant BuildDeployJob
participant AzureStaticWebApps
User->>SetEnvironmentJob: workflow_dispatch (environment input)
SetEnvironmentJob->>SetEnvironmentJob: map input to Testing/dev/stage/prod
SetEnvironmentJob->>BuildDeployJob: pass target environment output
BuildDeployJob->>BuildDeployJob: checkout, setup Node 20, install deps
BuildDeployJob->>BuildDeployJob: build .env from vars.ENV_CONFIG, npm run generate
BuildDeployJob->>AzureStaticWebApps: upload build output (skip_app_build: true)
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/deploy-to-azure.yml (3)
47-51: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winTemplate expansion into shell (template-injection).
zizmor flags
${{ vars.ENV_CONFIG }}expanded directly into therun:script; if this value ever contains shell metacharacters it could break out of the quoting. Prefer passing it viaenv:and referencing the environment variable inside the script.🛡️ Suggested fix
- name: Ingest Environment Variables + env: + ENV_CONFIG: ${{ vars.ENV_CONFIG }} run: | touch .env - echo '${{ vars.ENV_CONFIG }}' | jq -r 'to_entries | map("\(.key)=\(.value)") | .[]' > .env + echo "$ENV_CONFIG" | jq -r 'to_entries | map("\(.key)=\(.value)") | .[]' > .env echo CI=false >> .env🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/deploy-to-azure.yml around lines 47 - 51, The Ingest Environment Variables step is expanding vars.ENV_CONFIG directly inside the run script, which risks template-injection if the value contains shell metacharacters. Update the workflow to pass ENV_CONFIG through env: on the step and reference that variable inside the script instead of embedding ${{ vars.ENV_CONFIG }} in the shell command; keep the existing jq-based .env generation logic in place.Source: Linters/SAST tools
38-44: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winBump
actions/checkoutandactions/setup-nodeversions.actionlint reports the runners for
actions/checkout@v3andactions/setup-node@v3are too old for GitHub Actions. Per the retrieved learning, mutable tag usage itself isn't a concern in this repo, but this flags an actual deprecation, not a SHA-pinning preference.♻️ Suggested fix
- uses: actions/checkout@v3 + uses: actions/checkout@v4- uses: actions/setup-node@v3 + uses: actions/setup-node@v4🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/deploy-to-azure.yml around lines 38 - 44, Bump the GitHub Actions used in the deploy workflow: update the `actions/checkout` and `actions/setup-node` steps in the workflow to newer supported major versions, keeping the existing `ref` and `node-version` settings intact. Locate the changes in the deploy workflow’s `checkout` and `Setup Node.js` steps and replace the old action versions with current ones that satisfy actionlint’s runner requirements.Source: Linters/SAST tools
1-66: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAdd explicit least-privilege
permissions:block.zizmor flags excessive-permissions at the workflow and both job levels since no
permissions:block is defined, defaulting to broad token scope. Given this workflow only checks out code and deploys,contents: read(plus nothing else needed byAzure/static-web-apps-deploy) should suffice.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/deploy-to-azure.yml around lines 1 - 66, Add an explicit least-privilege permissions block to the workflow and jobs because the default GITHUB_TOKEN scope is too broad. Update the workflow definition in deploy-to-azure.yml so the top-level and both jobs set only the minimal token access needed, and ensure the checkout/deploy flow in set-github-environment and build-and-deploy uses contents: read unless Azure/static-web-apps-deploy requires any additional specific permission.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/deploy-to-azure.yml:
- Around line 24-30: The environment mapping in the deploy workflow is reading
the wrong dispatch input, so `set-github-environment` never produces a target
value. Update the `case` in the workflow step to use the actual
`workflow_dispatch` input name (`inputs.environment`) instead of
`inputs.environment_input`, and keep the existing `target_env` mappings for
`testing`, `development`, `staging`, and `production` so the step outputs the
expected environment.
---
Nitpick comments:
In @.github/workflows/deploy-to-azure.yml:
- Around line 47-51: The Ingest Environment Variables step is expanding
vars.ENV_CONFIG directly inside the run script, which risks template-injection
if the value contains shell metacharacters. Update the workflow to pass
ENV_CONFIG through env: on the step and reference that variable inside the
script instead of embedding ${{ vars.ENV_CONFIG }} in the shell command; keep
the existing jq-based .env generation logic in place.
- Around line 38-44: Bump the GitHub Actions used in the deploy workflow: update
the `actions/checkout` and `actions/setup-node` steps in the workflow to newer
supported major versions, keeping the existing `ref` and `node-version` settings
intact. Locate the changes in the deploy workflow’s `checkout` and `Setup
Node.js` steps and replace the old action versions with current ones that
satisfy actionlint’s runner requirements.
- Around line 1-66: Add an explicit least-privilege permissions block to the
workflow and jobs because the default GITHUB_TOKEN scope is too broad. Update
the workflow definition in deploy-to-azure.yml so the top-level and both jobs
set only the minimal token access needed, and ensure the checkout/deploy flow in
set-github-environment and build-and-deploy uses contents: read unless
Azure/static-web-apps-deploy requires any additional specific permission.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0a120528-16dd-4cbc-9f36-fd50ed65d0e5
📒 Files selected for processing (2)
.github/workflows/deploy-to-azure.ymlstaticwebapp.config.json
Github workflow for testing purpose
This pull request introduces a new GitHub Actions workflow for deploying the application to Azure Static Web Apps and adds a configuration file to support client-side routing. The main changes focus on automating the deployment process and ensuring proper routing behavior in the deployed app.
Deployment automation:
.github/workflows/deploy-to-azure.ymlto automate deployments to Azure Static Web Apps, with support for multiple environments (production, staging, development, testing) and environment-specific configuration handling.Routing configuration:
staticwebapp.config.jsonto enable navigation fallback, ensuring that client-side routing works correctly by rewriting all navigation requests toindex.html.Added a new GitHub Actions workflow to deploy the app to Azure Static Web Apps with manual environment selection for production, staging, development, and testing. The workflow prepares environment-specific config, builds the app, includes
staticwebapp.config.jsonin the output, and deploys the generated static site with Azure’s deploy action.Also added
staticwebapp.config.jsonwith a navigation fallback rule so unmatched routes rewrite toindex.html, enabling client-side routing in the deployed app.